#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2021/7/23 17:19
# @Author  : Samge
from PyQt5 import QtWidgets, QtCore


class ClickQLabel(QtWidgets.QLabel):

    # 自定义信号, 注意信号必须为类属性
    clicked = QtCore.pyqtSignal(str)

    def __init__(self, parent=None, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)

    def mouseReleaseEvent(self, QMouseEvent):
        self.clicked.emit(self.text().replace(':', ''))

    # 可在外部与槽函数连接
    def connect_clicked_slot(self, func):
        self.clicked.connect(func)

